/**
 * Inject dependanceies into index.html, HTML TASK
 * @Author: jiangcheng198745@hotmail.com
 * @Date: 2016/07/06
 */
'use strict';

import gulp from 'gulp';
import rename from 'gulp-rename';
import inject from 'gulp-inject';
import {argv as args} from 'yargs';
import {reload} from 'browser-sync';
import runSeq from 'run-sequence';


gulp.task('build', ['clean'], (done) => {
    let tasks = [];

    if (!args.nolint) {
        tasks.push('analyze');
    }

    tasks.push([
        'scss:build',
        'browserify',
        'copy:build'
    ]);
    tasks.push('processHTML:build');

    if (args.karmaSplit) {
        tasks.push('karma-each');
    } else {
        tasks.push('karma-config');
        tasks.push('karma')
    }

    tasks.push(done)

    runSeq.apply(this, tasks);
});